import { createApp } from "vue";
import App from "./App.vue";
//引入element-plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementIcons from "@element-plus/icons-vue"; //引入图标组件
import zhCn from "element-plus/es/locale/lang/zh-cn"; // 引入中文语言包
//在main.js中使用路由
import {router} from "./router/index.js";
import { createPinia } from "pinia";
import piniaPersistedState from "pinia-plugin-persistedstate";

import axios from "axios";
// 指定 axios 的全局配置，指定为后端服务器地址
axios.defaults.baseURL = "http://localhost:8080/";
//配置插件
const pinia = createPinia();
pinia.use(piniaPersistedState);
const app = createApp(App);
//将axios进行全局配置
app.config.globalProperties.$axios = axios;
app.use(ElementPlus);
// 全局注册图标
for (const [key, component] of Object.entries(ElementIcons)) {
    app.component(key, component);
}
app.use(ElementPlus, { locale: zhCn });
app.use(router);
app.use(pinia);
app.mount("#app");
